<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付</title>
</head>
<script type="text/javascript" src="/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
    function pay() {
        var orderNo = document.getElementById("orderNo").value;
        var payNo = document.getElementById("payNo").value
        var param = "orderNo=" + orderNo + "&payNo=" + payNo;

        $.ajax({
            // 隐藏真实URL
            url: "/pay",
            type: "POST",
            data: param,
            cache: false,
            success: function (data) {
                if (data.data == "success") {
                    alert("恭喜您，抢购成功！")
                    window.location.href = "/order";
                } else {
                    alert("支付失败，请重试！")
                }
            },
            error: function () {
            }
        });
    }
</script>
<body>

订单号：<input id="orderNo" type="text" value=""/><br/>

支付号：<input id="payNo" type="text" value=""/><br/>

<input type="button" value="支付" onclick="pay()"/>

</body>
</html>